package com.wind.plugin.openAction;

import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorPolicy;
import com.intellij.openapi.fileEditor.FileEditorProvider;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

import static com.intellij.openapi.fileEditor.FileEditorPolicy.*;

public class CustomTextEditorProvider implements FileEditorProvider {

    @Override
    public @NotNull FileEditor createEditor(Project project, VirtualFile file) {
        return new CustomTextEditorAi(project, file);
    }

    @Override
    public boolean accept(Project project, VirtualFile file) {
        // 这里只处理 XML 文件，当然你可以扩展为其他类型
        return file.getName().endsWith(".biz");
    }

    @Override
    public String getEditorTypeId() {
        return "CustomTextEditor";
    }

    @NotNull
    @Override
    public FileEditorPolicy getPolicy() {
        return PLACE_AFTER_DEFAULT_EDITOR;
    }
}
